<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;

/* @var $this yii\web\View */
/* @var $model app\models\Dept */
/* @var $form yii\widgets\ActiveForm */
?>

<?php
$menusArr = $menus;
?>

<div class="dept-form">

    <h4><?= Html::encode($model->isNewRecord ? '新建部门>>' : '更新部门>>') ?></h4>
    <div class="panel panel-default">
        <!--<div class="panel-heading text-center" style="background: #003eff;color:white">dept</div>-->
        <div class="panel-body">
            <?php
            $form = ActiveForm::begin([
                        'options' => ['class' => 'form-horizontal form-group'],
                        'fieldConfig' => [
                            'template' => "{label}<div class=\"col-lg-10\">{input}</div>",
                            'labelOptions' => ['class' => 'col-lg-2 control-label'],
                        ]
            ]);
            ?>

            <div class="col-lg-4 col-xs-12 col-sm-4 col-md-4">
                <?= $form->field($model, 'dname')->textInput(['maxlength' => true]) ?>
            </div>
            <div class="col-lg-4 col-xs-12 col-sm-4 col-md-4 hidden">
                <?= $form->field($model, 'serverid')->textInput(['maxlength' => true]) ?>
            </div>
            <div class="col-lg-4 col-xs-12 col-sm-4 col-md-4">
                <?php //$form->field($model, 'parentserverid')->textInput(['maxlength' => true]) ?>

                <?php
                echo $form->field($model, 'parentserverid')->dropDownList(
                        ArrayHelper::map($menusArr, 'id', 'name'), ['prompt' => '请选择父级部门'])->label('父级部门')
                ?>


            </div>
            <div class="col-lg-4 col-xs-12 col-sm-4 col-md-4 hidden">
                <?= $form->field($model, 'operate')->textInput(['maxlength' => true,'value'=>'keep']) ?>
            </div>
            <div class="col-lg-12 col-xs-12 col-sm-12 col-md-12">
                <div class="form-group">
                    <?= Html::submitButton('保存', ['class' => 'btn btn-success col-lg-offset-5 col-md-offset-5']) ?>
                    <?= Html::a('返回', ['index'], ['class' => 'btn btn-primary']) ?>
                </div>
            </div>

            <?php ActiveForm::end(); ?>
        </div>
    </div>

</div>
